#!/usr/bin/python
import settings
import os
import subprocess
import sys

def get_report():
    result = {}
    for path in getattr(settings, 'DISKUSAGE', ()):
        if not os.path.exists(path):
            sys.stderr.write('Path does not exists: %s\n' % path)
            continue
        if os.path.isfile(path):
            result[path] = os.path.getsize(path)
        else:
            output = subprocess.Popen(['du', '-s', path], stdout=subprocess.PIPE).communicate()[0]
            result[path] = int(output.split()[0])
    return result

if __name__ == '__main__':
    print get_report()
